package com.carl.zeus.dao.system;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import com.carl.zeus.model.system.SysMenu;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface SysMenuMapper extends BaseMapper<SysMenu> {

    List<SysMenu> queryList(Map<String, Object> map);

    /**
     * 根据父菜单，查询子菜单
     * @param parentId 父菜单ID
     */
    @Results({
            @Result(column="parent_id",property="parentId"),
            @Result(column="create_time",property="createTime"),
            @Result(column="update_time",property="updateTime")
    })
    @Select("select * from sys_menu where parent_id = #{parentId} order by sort asc")
    List<SysMenu> queryListParentId(Long parentId);

    /**
     * 获取不包含按钮的菜单列表
     */
    List<SysMenu> queryNotButtonList();

    /**
     * 查询用户的权限列表
     * @param userId
     * @return
     */
    List<SysMenu> queryUserList(Long userId);

    int deleteBatch(Object[] id);

    /**
     * 查询有效的,URL不为空的所有菜单信息
     * @return
     */
    List<SysMenu> selectMenuUrlAllList();

    /**
     * 根据用户Id查询用户资源菜单信息
     * @param userId
     * @return
     */
    List<SysMenu> selectMenuListByUserId(Long userId);

    List<SysMenu> selectMenuList(Pagination page, Integer state);
}